import { getJsapiSign } from '@/common/api'
export async function getWxSignature() {
  // const url = location.hostname
  const url = 'https://api.jishizhijia.com/'
  const context = getCurrentInstance()
  const proxy = context?.proxy
  const res = await getJsapiSign(url)
  const { data } = res
  proxy?.$wx.config({
    debug: false,
    appId: data.appId,
    timestamp: data.timestamp,
    nonceStr: data.nonceStr,
    signature: data.signature,
    jsApiList: [
      'chooseWXPay',
      'login'
    ]
  })
  proxy?.$wx.ready(function() {
    console.log('接口开通成功')
  })
  proxy?.$wx.error((err:any) => {
    console.log(err)
  })
}
